package com.engine.aviator.funs;

import com.engine.aviator.AbstractContextFunction;
import com.googlecode.aviator.runtime.type.AviatorDouble;
import com.googlecode.aviator.runtime.type.AviatorObject;

import java.util.Map;

public class CustomAddFunction extends AbstractContextFunction {

    @Override
    public AviatorObject execute(Map<String, Object> env,Object... objs) {
        double num1 = Double.valueOf(String.valueOf(objs[0]));
        double num2 = Double.valueOf(String.valueOf(objs[1]));;
        return new AviatorDouble(num1 + num2);
    }

    @Override
    public String getName() {
        return "customAdd";
    }
}
